package com.itheima.health.dao;

import com.itheima.health.pojo.Permission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.Set;

/**
 * @Author: liangWeiQUQ
 * @Description: 查询权限的具体信息
 * @DateTime: 2021/3/8 12:28
 **/
public interface PermissionDao extends Mapper<Permission> {
    /**
       * @Author: 传闻中的梁大侠 
       * @Date: 15:05 2021/3/8
       * @Parms [id]
       * @ReturnType: java.util.Set<com.itheima.health.pojo.Permission>
       * @Description: 查询权限的具体信息
     */
    @Select("SELECT t1.* FROM t_permission t1 JOIN t_role_permission t2 ON t1.id = t2.permission_id " +
            "JOIN t_role t3 ON t2.role_id = t3.id WHERE t3.id = #{id}")
    Set<Permission> findByRoleId(@Param("id") Integer id);
}
